import matplotlib.pyplot as plt
import pandas as pd
from datetime import datetime

plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']
plt.rcParams['axes.unicode_minus'] = False
data = pd.read_csv("./data/content.csv")
time = data['出现时间点']

time = time.apply(lambda x: datetime.fromtimestamp(x).strftime("%H:%M:%S"))
time = time.value_counts().sort_index()
x = time.index.to_list()

# 设置图框的大小
fig = plt.figure(figsize=(18, 6))
plt.title("《夺冠》高峰分析")
plt.xlabel("秒")
plt.ylabel("评论数量")
plt.xticks(range(0, 8000, 1000), range(0, 8000, 1000))
plt.plot(x, time, linestyle='--', linewidth=1, color='green')

# 剔除图框上边界和右边界的刻度
plt.tick_params(top='off', right='off')

fig.autofmt_xdate(rotation=45)

plt.show()
